package com.community.itelligentcommunity.community.myCommunity.service;

import com.community.itelligentcommunity.common.base.dao.GenericDao;
import com.community.itelligentcommunity.common.base.service.GenericService;
import com.community.itelligentcommunity.common.util.user.UserInfo;
import com.community.itelligentcommunity.community.myCommunity.dao.DecorationApplyDao;
import com.community.itelligentcommunity.community.myCommunity.entity.DecorationApply;
import com.community.itelligentcommunity.community.myCommunity.entity.QueryDecorationApply;
import com.community.itelligentcommunity.sys.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = {IllegalArgumentException.class})
public class DecorationApplyService extends GenericService<DecorationApply, QueryDecorationApply> {
    @Autowired
    private DecorationApplyDao decorationApplyDao;

    @Override
    protected GenericDao<DecorationApply, QueryDecorationApply> getDao() {
        return decorationApplyDao;
    }


    @Override
    public boolean save(DecorationApply entity) throws Exception {

        User uf= UserInfo.getUser();
        entity.setApplyId(uf.getId());
        return super.save(entity);
    }
}

